package com.com.hefei.wdp.example.controller;


import com.com.hefei.wdp.example.service.ProducerService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class ProducerController {
    @Autowired
    private DiscoveryClient discoveryClient;
    @Autowired
    ProducerService producerService;

    @GetMapping("/appInfo")
    public String getAppInfo() throws InterruptedException {
        return producerService.getAppInfo();
    }

    @GetMapping("/appInfo2/{id}")
    public String getAppInfo2(@PathVariable("id") Integer id) throws InterruptedException {
        return producerService.getAppInfo2( id);
    }


    @GetMapping("/serviceInfo")
    public String getServiceInfo(){
        discoveryClient.getServices();
        discoveryClient.description();
        discoveryClient.getOrder();
        return "";
    }
}
